﻿using System;
using System.Collections.Generic;

using System.Text;

namespace ITAP.ShprossesBuilder.Manipulation
{
    public class CommandEventPairs 
    {
        List<IModelComponentCommand> commands;

        public List<IModelComponentCommand> Commands
        {
            get { return commands; }
            set { commands = value; }
        }
        List<MouseManagerEvent> events;

        public CommandEventPairs()
        {
            commands = new List<IModelComponentCommand>();
            events = new List<MouseManagerEvent>();
        }

        public void Add(IModelComponentCommand command, MouseManagerEvent mouseEvent)
        {
            commands.Add(command);
            events.Add(mouseEvent);
        }

        public void Clear()
        {
            commands.Clear();
            events.Clear();
        }

        public List<IModelComponentCommand> GetCommandsByEvent(MouseManagerEvent mouseEvent)
        {
            List<IModelComponentCommand> result = new List<IModelComponentCommand>();
            for (int i = 0; i < events.Count; i++)
                if (events[i].Equals(mouseEvent))
                {
                    result.Add((IModelComponentCommand)commands[i]);
                }

            return result;
        }
    }
}
